package com.yyplatform.admin.infra.utils;

import com.yyplatform.admin.infra.model.dto.RequestInfoDTO;

import jakarta.servlet.http.HttpServletRequest;

/**
 * Created on 2024-09-14
 */
public class RequestInfoUtils {
    public static RequestInfoDTO build(HttpServletRequest request) {
        RequestInfoDTO shiroCheckDTO = new RequestInfoDTO();

        shiroCheckDTO.setUrl(RequestUtils.getUrl(request));
        shiroCheckDTO.setMethod(RequestUtils.getMethod(request));
        shiroCheckDTO.setIp(RequestUtils.getIp(request));
        shiroCheckDTO.setReferer(RequestUtils.getReferer(request));
        shiroCheckDTO.setLocation(RequestUtils.getLocation(request));
        shiroCheckDTO.setUserAgent(RequestUtils.getUserAgent(request));
        shiroCheckDTO.setOs(RequestUtils.getOs(request));
        shiroCheckDTO.setBrowser(RequestUtils.getBrowser(request));

        return shiroCheckDTO;
    }

}
